package net.comm.friend.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.friend.bean.BaseFriend;
import net.comm.util.StringUtil;

import org.sakaiproject.db.api.SqlReader;

public class DbFriendService implements SqlReader
{

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  seqID = result.getInt(1);				//序号ID
			int  userID = result.getInt(2);				//会员ID
			int  friendID = result.getInt(3);			//
			int  teamID = result.getInt(4);				//好友所在组
			String  status = StringUtil.getValue(result.getString(5));			//操作类型
			String  mtime = StringUtil.getValue(result.getString(6));				

			// create the Resource from these fields
			return new BaseFriend( seqID,  userID, friendID, teamID, status, mtime);
		}
		catch (SQLException e)
		{
			return null;
		}
		
	}
}
